#define _CRT_SECURE_NO_WARNINGS 1
#include"SeqList.h"
#include<assert.h>
void SLInit(SL* s)
{
	s->arr = NULL;
	s->size = 0;
	s->capacity = 0;
}
void SLDestroy(SL *P)
{
	if (P->arr)
	{
		free(P->arr);
	}
	P->arr = NULL;
	P->size = P->capacity = 0;

}
void SLpushback(SL* p, PInfor a)
{
	if (p->capacity == p->size)
	{
		int newcapacity = p->capacity == 0 ? 4: p->capacity * 2;
		p->arr = (PInfor*)realloc(p->arr, newcapacity * sizeof(PInfor));
		p->capacity = newcapacity;
	}
	p->arr[p->size++] = a;
}


void SLErase(SL* p, int pos)
{
	assert(p->size);
	int i = pos-1;
	for (i; i <= p->size-1; i++)
	{
		p->arr[i] = p->arr[i+1];
	}
	p->size--;
}
